'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 踢人
 * @author sundbcn@gmail.com (sun debing)
 */
var pomelo = require('pomelo');
var async = require('async');
var _ = require('lodash');
var Code = require('../../../consts/code');
var PlayerManager = require('../../../libs/playerManager');
var entryRemote = require('../../connector/remote/entryRemote.js');

module.exports = function (app) {
    return new Handler(app);
};

var Handler = function (app) {
    this.app = app;
};

/**
 * 停服维护
 */
Handler.prototype.stopServer = function (msg, session, next) {
    this.app.rpc.connector.entryRemote.stopServer(session,
        function (err) {
            if (!!err) {
                console.error(err);
                return next(null, {
                    code: Code.FAIL
                });
            }
            return next(null, {
                code: Code.OK
            });
        });
};

/**
 * 撤销停服
 */
Handler.prototype.continueServer = function (msg, session, next) {
    this.app.rpc.connector.entryRemote.continueServer(session,
        function (err) {
            if (!!err) {
                console.error(err);
                return next(null, {
                    code: Code.FAIL
                });
            }
            return next(null, {
                code: Code.OK
            });
        });
};
